<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\enums\StatusEnum;
use common\models\backend\AdminBank;

$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'class' => 'form-horizontal',
    'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id']]),
    'fieldConfig' => [
        'template' => "<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>

<div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title">基本信息</h4>
    </div>
    <div class="modal-body">
        <?= $form->field($model, 'pay_type')->widget(\kartik\select2\Select2::class, [
            'data' => AdminBank::getMap(),
            'options' => ['placeholder' => '请选择'],
            'pluginOptions' => [
                'allowClear' => true
            ],
        ]); ?>
        <?= $form->field($model, 'bank_user_name')->textInput() ?>
        <?= $form->field($model, 'bank_name')->textInput() ?>
        <?= $form->field($model, 'bank_account')->textInput() ?>
        <?= $form->field($model, 'bank_img')->widget(\common\widgets\webuploader\Files::class, [
                'type' => 'images',
                'theme' => 'default',
                'themeConfig' => [],
                'config' => [
                    // 可设置自己的上传地址, 不设置则默认地址
                    // 'server' => '',
                    'pick' => [
                        'multiple' => false,
                    ],
                ]
        ]); ?>
        <?= $form->field($model, 'state')->radioList(StatusEnum::getMap()); ?>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
        <button class="btn btn-primary" type="submit">保存</button>
    </div>
</div>

<?php ActiveForm::end(); ?>